import request from "@/libs/request";

const basePath = '/appcloud-portal' ;

export const apiUrls = {
  getMenu : basePath + '/menu/getMenu',
  getMenuByRoleId : basePath + '/menu/getMenuByRoleId',
  getMenuByUserId : basePath + '/menu/getMenuByUserId',
  getMenuList : basePath + '/menu/getMenuList',
  saveMenu : basePath + '/menu/saveMenu',
  updateMenu : basePath + '/menu/updateMenu',
  deleteMenu :basePath + '/menu/deleteMenu/'
}

//根据id获取菜单
export async function getMenu(id){
	return request( apiUrls.getMenu + '?' + 'id' + '=' + id, {
      method:'POST'
  })
}

//根据角色id获取菜单树
export async function getMenuByRoleId(RoleId){
	return request( apiUrls.getMenuByRoleId + '?' + 'roleId' + '=' + RoleId, {
      method:'POST',
  })
}

//根据用户id获取菜单树
export async function getMenuByUserId(id){
	return request( apiUrls.getMenuByUserId + '?' + 'userId' + '=' + id, {
      method:'POST',
  })
}

//获取所有菜单树
export async function getMenuList(params){
	return request( apiUrls.getMenuList, {
      method:'POST',
      body:params
  })
}

//保存菜单
export async function saveMenu(params){
	return request( apiUrls.saveMenu, {
      method:'POST',
      body:params
  })
}

//修改菜单
export async function updateMenu(params){
	return request( apiUrls.updateMenu, {
      method:'POST',
      body:params
  })
}
//删除菜单
export async function deleteMenu(id) {
  return request(apiUrls.deleteMenu + id ,{
    method:'GET'
  })
  
}